Skip to content

Make artifact URL prefix configurable#13367

Merged
manuelbuil merged 1 commit intok3s-io:mainfrom
manuelbuil:k3sartifacturl
Feb 23, 2026
Merged

Make artifact URL prefix configurable#13367
manuelbuil merged 1 commit intok3s-io:mainfrom
manuelbuil:k3sartifacturl

Conversation

@manuelbuil
Copy link
Copy Markdown
Contributor

@manuelbuil manuelbuil commented Dec 17, 2025

Proposed Changes

Allow setting INSTALL_K3S_ARTIFACT_URL to override URL prefix for release artifacts, to allow downloading K3s from locations other than GitHub.

Breaking Variable Changes! It replaces the env var GITHUB_URL which was doing a similar thing but required the repo to be in Github

Types of Changes

New feature

Verification

Taking the install.sh script:

INSTALL_K3S_VERSION=v1.32.10+k3s1 INSTALL_K3S_ARTIFACT_URL="https://${url}/k3s"

Testing

Linked Issues

#13366

User-Facing Change

Added INSTALL_K3S_ARTIFACT_URL to donwload K3s binary from a different URL

Further Comments

@manuelbuil manuelbuil requested a review from a team as a code owner December 17, 2025 14:13
@manuelbuil manuelbuil requested review from Copilot and removed request for a team December 17, 2025 14:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR makes the K3s artifact URL prefix configurable by introducing the INSTALL_K3S_ARTIFACT_URL environment variable, replacing the previous GITHUB_URL variable. This allows K3s to be downloaded from locations other than GitHub, such as private mirrors or alternative artifact repositories. The default behavior remains unchanged, pointing to the official GitHub releases.

Key changes:

  • Added INSTALL_K3S_ARTIFACT_URL environment variable with documentation
  • Implemented URL-safe encoding for version strings containing special characters (e.g., "+" becomes "%2B")
  • Updated artifact download URLs to use the new configurable prefix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread install.sh Outdated
brandond
brandond previously approved these changes Dec 17, 2025
@1orelai
Copy link
Copy Markdown

1orelai commented Dec 26, 2025

This should work for public endpoints, but what if INSTALL_K3S_ARTIFACT_URL requires additional curl/wget options (auth/proxy/etc) within download function?

Could possibly use support for specifying local artifact via filesystem path

@brandond
Copy link
Copy Markdown
Member

brandond commented Dec 26, 2025

We don't need to solve all possibile problems now, just add parity with what the rke2 install script can do.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread install.sh Outdated
Comment thread install.sh
@manuelbuil manuelbuil force-pushed the k3sartifacturl branch 3 times, most recently from 2941985 to f196f49 Compare February 9, 2026 14:27
dereknola
dereknola previously approved these changes Feb 9, 2026
Comment thread install.sh Outdated

# GITHUB_URL was replaced by INSTALL_K3S_ARTIFACT_URL
if [ -n "$GITHUB_URL" ]; then
echo "WARNING: 'GITHUB_URL' is deprecated and will be removed in a future release." >&2
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't accurate - deprecated would indicate that it is outdated but still works. It doesn't work and support for it has already been removed.

Either make it work again, or correct the warning to indicate that support for it is CURRENTLY removed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes 🤦

Comment thread install.sh Outdated

# GITHUB_URL was replaced by INSTALL_K3S_ARTIFACT_URL
if [ -n "$GITHUB_URL" ]; then
echo "WARNING: 'GITHUB_URL' does not work anymore. Please use 'INSTALL_K3S_ARTIFACT_URL' instead." >&2
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have info/warn/error helpers, use those:

Suggested change
echo "WARNING: 'GITHUB_URL' does not work anymore. Please use 'INSTALL_K3S_ARTIFACT_URL' instead." >&2
warn "'GITHUB_URL' does not work anymore. Please use 'INSTALL_K3S_ARTIFACT_URL' instead."

You'll need to move this down below the function definitions to do that - perhaps next to the VERSION_URLSAFE on line 390?

Copy link
Copy Markdown
Contributor Author

@manuelbuil manuelbuil Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. But why so far away? Warn is the 2nd function that gets defined, I could add it below it. Let me know what you think

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the convention in this script is to define logic in functions, and then call those functions. Having this test+warn bit outside a function breaks that convention.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, that's a good point. We should follow convention. I'm going to add it in the "download_and_verify()" function right before "download_hash", which is the first place where GITHUB_URL was used.

I don't add it in "download_hash" function because "download_binary" also used GITHUB_URL, and it might be confusing if it is only in one of the functions. I'm also not creating a new function just for that logic, since it's three lines and just adding a log. Tell me what you think, I'm ok with changing that

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread install.sh
Comment thread install.sh Outdated
Comment thread install.sh
Signed-off-by: Manuel Buil <mbuil@suse.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 21.36%. Comparing base (76225db) to head (16d81d3).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13367      +/-   ##
==========================================
- Coverage   21.42%   21.36%   -0.07%     
==========================================
  Files         191      191              
  Lines       15508    15513       +5     
==========================================
- Hits         3323     3314       -9     
- Misses      11729    11751      +22     
+ Partials      456      448       -8     
Flag Coverage Δ
unittests 21.36% <ø> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@manuelbuil manuelbuil merged commit 702aba6 into k3s-io:main Feb 23, 2026
132 of 135 checks passed
@manuelbuil manuelbuil deleted the k3sartifacturl branch February 23, 2026 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants